/*
   Mr. Thunder
   Made by ups2000ups
   Cleaned by wackyracer
*/

void npc(Player @player, NPC @npc) {
	int state = npc.getState();
	int type = npc.getSelected();
	npc.setVariable("type", type);
	string [] menu    = {"Refine the raw ore of a mineral", "Refine a jewel", "Upgrade a Helmet", "Upgrade a Shield"};
	int [] midID		= {0000000, 0000000, 0};
	int [] mineral 		= {8, 4011000, 4011001, 4011002, 4011003, 4011004, 4011005, 4011006};
	int [] _Bronze  	= {4011000, 4010000, 300};
	int [] _Steel		= {4011001, 4010001, 300};
	int [] _Mithril 	= {4011002, 4010002, 300};
	int [] _Adamant 	= {4011003, 4010003, 500};
	int [] _Silver  	= {4011004, 4010004, 500};
	int [] _Orihalcon  	= {4011005, 4010005, 500};
	int [] _Gold	  	= {4011006, 4010006, 800};
	int [] jewel   		= {10, 4021000, 4021001, 4021002, 4021003, 4021004, 4021005, 4021006, 4021007, 4021008};
	int [] _Garnet		= {4021000, 4020000, 500};
	int [] _Amethyst	= {4021001, 4020001, 500};
	int [] _AquaMarine	= {4021002, 4020002, 500};
	int [] _Emerald		= {4021003, 4020003, 500};
	int [] _Opal		= {4021004, 4020004, 500};
	int [] _Sapphire	= {4021005, 4020005, 500};
	int [] _Topaz		= {4021006, 4020006, 500};
	int [] _Diamond		= {4021007, 4020007, 1000};
	int [] _BlackCrystal	= {4021008, 4020008, 3000};

//--------------------------Shield-------------------------------
	int [] shield		= {5, 1092013, 1092014, 1092010, 1092011};
	string [] shieldinfo	= {"empty", "(level limit : 40, warrior)", "(level limit : 40, warrior)", "(level limit : 60, warrior)", "(level limit : 60, warrior)"};
	string [] shieldstatinfo = {"empty", "STR +2", "DEX+2", "DEX+2", "STR+2"};

	// Info and usage
	int [] _MithrilTowerShield 		= {4, 1092012, 4011002, 100000};
	int [] _MithrilTowerShieldinfo 		= {0, 1      , 10     , 0};
	int [] _MTScoast			= {1092012, 4011002, 100000, 1092013};
	
        int [] _AdamantiumTowerShield 		= {4, 1092012, 4011003, 100000};
	int [] _AdamantiumTowerShieldinfo 	= {0, 1      , 10     , 0};
	int [] _ATScoast			= {1092012, 4011003, 100000, 1092014};
	
        int [] _SilverLegendShield 		= {5, 1092009, 4011007, 4011004, 120000};
	int [] _SilverLegendShieldinfo 		= {0, 1      , 1      , 15     , 0};
	int [] _SLScoast			= {1092009, 4011007, 4011004, 120000, 1092010};

	int [] _AdamantiumLegendShield 		= {5, 1092009, 4011007, 4011003, 120000};
	int [] _AdamantiumLegendShieldinfo 	= {0, 1      , 1      , 15     , 0};
	int [] _ALScoast			= {1092009, 4011007, 4011003, 120000, 1092011};
	
//--------------------------Helmets----------------------------------
	int [] helm		= {25, 1002041, 1002042, 1002002, 1002044, 1002003, 1002040, 1002007, 1002052, 1002011, 1002058, 1002009, 1002056, 1002087, 1002088, 1002049, 1002050, 1002047, 1002048, 1002099, 1002098, 1002085, 1002028, 1002022, 1002101};
	string [] helminfo	= {"Emplty", "(level limit : 15, all)", "(level limit : 15, all)", "(level limit : 10, warrior)", "(level limit : 10, warrior)", "(level limit : 12, warrior)", "(level limit : 12, warrior)", "(level limit : 15, warrior)", "(level limit : 15, warrior)", "(level limit : 20, warrior)", "(level limit : 20, warrior)", "(level limit : 20, warrior)", "(level limit : 20, warrior)", "(level limit : 22, warrior)", "(level limit : 22, warrior)", "(level limit : 25, warrior)", "(level limit : 25, warrior)", "(level limit : 35, warrior)", "(level limit : 35, warrior)", "(level limit : 40, warrior)", "(level limit : 40, warrior)", "(level limit : 50, warrior)", "(level limit : 50, warrior)", "(level limit : 55, warrior)", "(level limit : 55, warrior)"};

	int [] _YellowMetalGear		= {4, 1002001, 4021006, 300};
	int [] _YellowMetalGearinfo	= {0, 1      , 1      , 0};
	int [] _YMGcoast		= {1002001, 4021006, 300, 1002041};

	int [] _BluewMetalGear		= {4, 1002001, 4011002, 300};
	int [] _BluewMetalGearinfo	= {0, 1      , 1      , 0};
	int [] _BMGcoast		= {1002001, 4011002, 300, 1002042};

	int [] _MetalKoif		= {4, 1002043, 4011000, 500};
	int [] _MetalKoifinfo		= {0, 1      , 1      , 0};
	int [] _MKcoast			= {1002043, 4011000, 500, 1002002};

	int [] _MithrilKoif		= {4, 1002043, 4011002, 500};
	int [] _MithrilKoifinfo		= {0, 1      , 1      , 0};
	int [] _MiKcoast		= {1002043, 4011002, 500, 1002044};

	int [] _SteelHelmet		= {4, 1002039, 4011001, 500};
	int [] _SteelHelmetinfo		= {0, 1      , 1      , 0};
	int [] _SHcoast			= {1002039, 4011001, 500, 1002003};

	int [] _MithrilHelmet		= {4, 1002039, 4011002, 800};
	int [] _MithrilHelmetinfo	= {0, 1      , 1      , 0};
	int [] _MHcoast			= {1002039, 4011002, 800, 1002040};

	int [] _SteelFullHelm		= {4, 1002051, 4011001, 1000};
	int [] _SteelFullHelminfo	= {0, 1      , 2      , 0};
	int [] _StFHcoast		= {1002051, 4011001, 1000, 1002007};

	int [] _MithrilFullHelm		= {4, 1002051, 4011002, 1500};
	int [] _MithrilFullHelminfo	= {0, 1      , 2      , 0};
	int [] _MiFHcoast		= {1002051, 4011002, 1500, 100205};

	int [] _IronVikingHelm		= {4, 1002059, 4011001, 1500};
	int [] _IronVikingHelminfo	= {0, 1      , 3      , 0};
	int [] _IVHcoast		= {1002059, 4011001, 1500, 100201};

	int [] _MithrilVikingHelm	= {4, 1002059, 4011002, 2000};
	int [] _MithrilVikingHelminfo	= {0, 1      , 3      , 0};
	int [] _MVHcoast		= {1002059, 4011002, 2000, 1002058};

	int [] _SteelFootballHelmet	= {4, 1002055, 4011001, 1500};
	int [] _SteelFootballHelmetinfo	= {0, 1      , 3      , 0};
	int [] _SFHcoast		= {1002055, 4011001, 1500, 1002009};

	int [] _MithrilFootballHelmet		= {4, 1002055, 4011002, 2000};
	int [] _MithrilFootballHelmetinfo	= {0, 1      , 3      , 0};
	int [] _MFHcoast			= {1002055, 4011002, 2000, 1002056};

	int [] _MithrilSharpHelm	= {4, 1002027, 4011002, 2000};
	int [] _MithrilSharpHelminfo	= {0, 1      , 4      , 0};
	int [] _MSHcoast		= {1002027, 4011002, 2000, 1002087};

	int [] _GoldSharpHelm		= {4, 1002027, 4011006, 4000};
	int [] _GoldSharpHelminfo	= {0, 1      , 4      , 0};
	int [] _GSHcoast		= {1002027, 4011006, 4000, 1002088};

	int [] _GoldBurgernetHelm	= {4, 1002005, 4011006, 4000};
	int [] _GoldBurgernetHelminfo	= {0, 1      , 5      , 0};
	int [] _GoBHcoast		= {1002005, 4011006, 4000, 1002049};

	int [] _OrihalconBurgernetHelm		= {4, 1002005, 4011005, 5000};
	int [] _OrihalconBurgernetHelminfo	= {0, 1      , 5      , 0};
	int [] _OBHcoast			= {1002005, 4011005, 5000, 1002050};

	int [] _GreatRedHelmet		= {4, 1002004, 3x4021000, 8000};
	int [] _GreatRedHelmetinfo	= {0, 1      , 3      , 0};
	int [] _GRHcoast		= {1002004, 3x4021000, 8000, 1002047};

	int [] _GreatBlueHelmet		= {4, 1002004, 4021005, 10000};
	int [] _GreatBlueHelmetinfo	= {0, 1      , 3      , 0};
	int [] _GBHcoast		= {1002004, 4021005, 10000, 1002048};

	int [] _MithrilNoordicHelm	= {4, 1002021, 4011002, 12000};
	int [] _MithrilNoordicHelminfo	= {0, 1      , 5      , 0};
	int [] _MNHcoast		= {1002021, 4011002, 12000, 1002099};

	int [] _GoldNoordicHelm		= {4, 1002021, 4011006, 15000};
	int [] _GoldNoordicHelminfo	= {0, 1      , 6      , 0};
	int [] _GNHcoast		= {1002021, 4011006, 15000, 1002098};

	int [] _MithrilCrusaderHelm	= {4, 1002086, 4011002, 20000};
	int [] _MithrilCrusaderHelminfo	= {0, 1      , 5      , 0};
	int [] _MCHcoast		= {1002086, 4011002, 20000, 1002085};

	int [] _SilverCrusaderHelm	= {4, 1002086, 4011004, 25000};
	int [] _SilverCrusaderHelminfo	= {0, 1      , 4      , 0};
	int [] _SCHcoast		= {1002086, 4011004, 25000, 1002028};

	int [] _OldSteelNordicHelm	= {5, 1002100, 4011007, 4011001, 30000};
	int [] _OldSteelNordicHelminfo	= {0, 1      , 1      , 7      , 0};
	int [] _OSNHcoast		= {1002100, 4011007, 4011001, 30000, 1002022};

	int [] _OldMithrilNordicHelm		= {5, 1002100, 4011007, 4011002, 30000};
	int [] _OldMithrilNordicHelminfo	= {0, 1      , 1      , 7      , 0};
	int [] _OMNHcoast			= {1002100, 4011007, 4011002, 30000, 1002101};
//----------------------------------------------------------------------------------------------------------------

	if(state == 0) {
		npc.addText("Wait, do you have the ore of either a jewel or a mineral? With a little service fee, I can turn them into materials needed to create weapons or shields. Not only that, I can also upgrade an item with it to make an even better item. What do you think? Do you want to do it?");
		npc.sendYesNo();
	}
	else if(state == 1){
		if(npc.getSelected() == YES){
			npc.addText("Alright, with the ore and a little service fee, I'll refine it so you can use it. Check and see if your etc storage has any room. Now... What would you like me to do?#b\r\n#L0#" + menu[0] + "#l\r\n#L1#" + menu[1] + "#l\r\n#L2#" + menu[2] + "#l\r\n#L3#" + menu[3] + "#l#k");
			npc.sendSimple();

		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. If you don't need it oh well... If you happen to collect a lot of ores in the future, please find me. I'll try and make something.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 2) {
		if(type == 0) {
			npc.addText("Which mineral do you want to make?");

			for(int x = 1; x < mineral[0]; x++){
				npc.addText("#b\r\n#L" + (x-1) + "##t" + mineral[x] + "##l#k");
			}
			npc.sendSimple();
			npc.setState(9);
		}
		else if(type == 1) {
			npc.addText("Which jewel do you want to make?");

			for(int x = 1; x < jewel[0]; x++){
				npc.addText("#b\r\n#L" + (x-1) + "##t" + jewel[x] + "##l#k");
			}
			npc.setState(19);
			npc.sendSimple();
		}
		else if(type == 2) {
			npc.addText("So you want to upgrade the Helmet? Ok, then. A word of warning, thought: All the items that will be used for upgrading will be gone, and if you use an item that has been #rupgraded#k with a scroll before, the effect will not go in when upgraded. Please take that into consideration when making the decision, OK?");
			npc.setState(99);
			npc.sendNext();
		}
		else if(type == 3){
			npc.addText("So you want to upgrade the Shield? Ok, then. A word of warning, thought: All the items that will be used for upgrading will be gone, and if you use an item that has been #rupgraded#k with a scroll before, the effect will not go in when upgraded. Please take that into consideration when making the decision, OK?");
			npc.setState(49);
			npc.sendNext();
		}
	}

//---------------------------------------- Minerals --------------------------------
	else if(state == 10) {
		npc.setGetSaveInt(type);

		if(npc.getSaveInt() == 0){
			midID = _Bronze;
		}
		else if(npc.getSaveInt() == 1){
			midID = _Steel;
		}
		else if(npc.getSaveInt() == 2){
			midID = _Mithril;
		}
		else if(npc.getSaveInt() == 3){
			midID = _Adamant;
		}
		else if(npc.getSaveInt() == 4){
			midID = _Silver;
		}
		else if(npc.getSaveInt() == 5){
			midID = _Orihalcon;
		}
		else if(npc.getSaveInt() == 6){
			midID = _Gold;
		}
		npc.addText("To make a(n) #t" + midID[0] + "#, I need the following materials. How many would you like to make?#b\r\n#v" + midID[1] + "# 10 #t" + midID[1] + "##k#b\r\n#v4031138# " + midID[2] + " mesos #k");
		npc.sendGetNumber(0,0,100);
	}
	else if(state == 11){
		if(npc.getSaveInt() == 0){             // added again since angelscript sux ? :D
			midID = _Bronze;
		}
		else if(npc.getSaveInt() == 1){
			midID = _Steel;
		}
		else if(npc.getSaveInt() == 2){
			midID = _Mithril;
		}
		else if(npc.getSaveInt() == 3){
			midID = _Adamant;
		}
		else if(npc.getSaveInt() == 4){
			midID = _Silver;
		}
		else if(npc.getSaveInt() == 5){
			midID = _Orihalcon;
		}
		else if(npc.getSaveInt() == 6){
			midID = _Gold;
		}

		npc.addText("To make #b" + npc.getNumber() + " #t" + midID[0] + "(s)##k, I need the following materials. Are you sure you want to make these?#b\r\n#v4031138# " + midID[2] + " mesos #k#b\r\n#v4031138# " + (npc.getNumber()*midID[2]) + " mesos #k");
		npc.sendYesNo();
	}
	else if(state == 12){
		if(npc.getSaveInt() == 0){             // added again since angelscript sux ? :D
			midID = _Bronze;
		}
		else if(npc.getSaveInt() == 1){
			midID = _Steel;
		}
		else if(npc.getSaveInt() == 2){
			midID = _Mithril;
		}
		else if(npc.getSaveInt() == 3){
			midID = _Adamant;
		}
		else if(npc.getSaveInt() == 4){
			midID = _Silver;
		}
		else if(npc.getSaveInt() == 5){
			midID = _Orihalcon;
		}
		else if(npc.getSaveInt() == 6){
			midID = _Gold;
		}
		if(npc.getSelected() == YES){
			if((player.getItemAmount(midID[1]) >= 10) && (player.getMesos() >= midID[2])) {
				player.giveItem(midID[1], -(10*npc.getNumber()));
				player.giveMesos(-(midID[2]*npc.getNumber()));
				player.giveItem(midID[0], npc.getNumber());
				npc.addText("Hey! Here, take " + npc.getNumber() + " #t" + midID[0] + "#(s). This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check if you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}

		}
		else if(npc.getSelected() == NO){
			npc.addText("Alright, come back soon then!");
			npc.sendNext();
			npc.end();
		}
	}

//---------------------------------------- Jewel --------------------------------
	else if(state == 20) {
		npc.setGetSaveInt(type);

		if(npc.getSaveInt() == 0){
			midID = _Garnet;
		}
		else if(npc.getSaveInt() == 1){
			midID = _Amethyst;
		}
		else if(npc.getSaveInt() == 2){
			midID = _AquaMarine;
		}
		else if(npc.getSaveInt() == 3){
			midID = _Emerald;
		}
		else if(npc.getSaveInt() == 4){
			midID = _Opal;
		}
		else if(npc.getSaveInt() == 5){
			midID = _Sapphire;
		}
		else if(npc.getSaveInt() == 6){
			midID = _Topaz;
		}
		else if(npc.getSaveInt() == 7){
			midID = _Diamond;
		}
		else if(npc.getSaveInt() == 8){
			midID = _BlackCrystal;
		}
		npc.addText("To make a(n) #t" + midID[0] + "#, I need the following materials. How many would you like to make?#b\r\n#v" + midID[1] + "# 10 #t" + midID[1] + "##k#b\r\n#v4031138# " + midID[2] + " mesos #k");
		npc.sendGetNumber(0,0,100);
	}
	else if(state == 21){
		if(npc.getSaveInt() == 0){
			midID = _Garnet;
		}
		else if(npc.getSaveInt() == 1){
			midID = _Amethyst;
		}
		else if(npc.getSaveInt() == 2){
			midID = _AquaMarine;
		}
		else if(npc.getSaveInt() == 3){
			midID = _Emerald;
		}
		else if(npc.getSaveInt() == 4){
			midID = _Opal;
		}
		else if(npc.getSaveInt() == 5){
			midID = _Sapphire;
		}
		else if(npc.getSaveInt() == 6){
			midID = _Topaz;
		}
		else if(npc.getSaveInt() == 7){
			midID = _Diamond;
		}
		else if(npc.getSaveInt() == 8){
			midID = _BlackCrystal;
		}

		npc.addText("To make #b" + npc.getNumber() + " #t" + midID[0] + "(s)##k, I need the following materials. Are you sure you want to make these?#b\r\n#v" + midID[1] + "# " + (npc.getNumber()*10) + " #t" + midID[1] + "##k#b\r\n#v4031138# " + (npc.getNumber()*midID[2]) + " mesos #k");
		npc.sendYesNo();
	}
	else if(state == 22){
		if(npc.getSaveInt() == 0){
			midID = _Garnet;
		}
		else if(npc.getSaveInt() == 1){
			midID = _Amethyst;
		}
		else if(npc.getSaveInt() == 2){
			midID = _AquaMarine;
		}
		else if(npc.getSaveInt() == 3){
			midID = _Emerald;
		}
		else if(npc.getSaveInt() == 4){
			midID = _Opal;
		}
		else if(npc.getSaveInt() == 5){
			midID = _Sapphire;
		}
		else if(npc.getSaveInt() == 6){
			midID = _Topaz;
		}
		else if(npc.getSaveInt() == 7){
			midID = _Diamond;
		}
		else if(npc.getSaveInt() == 8){
			midID = _BlackCrystal;
		}
		if(npc.getSelected() == YES){
			if((player.getItemAmount(midID[1]) >= 10) && (player.getMesos() >= midID[2])) {
				player.giveItem(midID[1], -(10*npc.getNumber()));
				player.giveMesos(-(midID[2]*npc.getNumber()));
				player.giveItem(midID[0], npc.getNumber());
				npc.addText("Hey! Here, take " + npc.getNumber() + " #t" + midID[0] + "#(s). This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Alright, come back soon then!");
			npc.sendNext();
			npc.end();
		}
	}
//---------------------------------------- Shields----------------------------------
	else if(state == 50){
		npc.addText("So, what kind of a Shield do you want to upgrade or create?");

		for(int x = 1; x < shield[0]; x++){
			npc.addText("#b\r\n#L" + (x-1) + "##t" + shield[x] + "##k " + shieldinfo[x] + "#l");
		}
		npc.sendSimple();
	}
	else if(state == 51){
		npc.addText("To upgrade one #t" + shield[type+1] + "#, I need following materials. Note this item has an option of " + shieldstatinfo[type+1] + ". Make sure you don't use an item that's been upgraded as a material for it. What do you think? Do you want one?");


		if(type == 0){
			for(int i = 1; i < _MithrilTowerShield[0]; i++){
				if(_MithrilTowerShieldinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilTowerShield[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilTowerShield[i] + "#  #t" + _MithrilTowerShield[i] + "##k");
				}
			} 
		}
		else if(type == 1){
			for(int i = 1; i < _AdamantiumTowerShield[0]; i++){
				if(_AdamantiumTowerShieldinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _AdamantiumTowerShield[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _AdamantiumTowerShield[i] + "#  #t" + _AdamantiumTowerShield[i] + "##k");
				}
			} 
		}
		else if(type == 2){
			for(int i = 1; i < _SilverLegendShield[0]; i++){
				if(_SilverLegendShieldinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _SilverLegendShield[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _SilverLegendShield[i] + "#  #t" + _SilverLegendShield[i] + "##k");
				}
			} 
		}
		else if(type == 3){
			for(int i = 1; i < _AdamantiumLegendShield[0]; i++){
				if(_AdamantiumLegendShieldinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _AdamantiumLegendShield[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _AdamantiumLegendShield[i] + "#  #t" + _AdamantiumLegendShield[i] + "##k");
				}
			} 
		}
		npc.setState(npc.getState()+type);
		npc.sendYesNo();
	}
	else if(state == 52){ // mithril Tower Shield
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MTScoast[0]) > 0) && (player.getItemAmount(_MTScoast[1]) >= 10) && (player.getMesos() >= _MTScoast[2])) {
				player.giveItem(_MTScoast[0], -1);
				player.giveItem(_MTScoast[1], -10);
				player.giveMesos(-_MTScoast[2]);
				player.giveItem(_MTScoast[3], 1);
				npc.addText("Hey! Here, take #t" + shield[0] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 53){ // Adamantium Tower Shield
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_ATScoast[0]) > 0) && (player.getItemAmount(_ATScoast[1]) >= 10) && (player.getMesos() >= _ATScoast[2])) {
				player.giveItem(_ATScoast[0], -1);
				player.giveItem(_ATScoast[1], -10);
				player.giveMesos(-_ATScoast[2]);
				player.giveItem(_ATScoast[3], 1);
				npc.addText("Hey! Here, take #t" + shield[1] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 54){ // Silver Legend Shield
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_SLScoast[0]) > 0) && (player.getItemAmount(_SLScoast[1]) > 0) && (player.getItemAmount(_SLScoast[2]) >= 15) && (player.getMesos() >= _SLScoast[3])) {
				player.giveItem(_SLScoast[0], -1);
				player.giveItem(_SLScoast[1], -1);
				player.giveItem(_SLScoast[2], -15);
				player.giveMesos(-_SLScoast[3]);
				player.giveItem(_SLScoast[4], 1);
				npc.addText("Hey! Here, take #t" + shield[2] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 55){ // Adamantium Legend Shield
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_ALScoast[0]) > 0) && (player.getItemAmount(_ALScoast[1]) > 0) && (player.getItemAmount(_ALScoast[2]) >= 15) && (player.getMesos() >= _ALScoast[3])) {
				player.giveItem(_ALScoast[0], -1);
				player.giveItem(_ALScoast[1], -1);
				player.giveItem(_ALScoast[2], -15);
				player.giveMesos(-_ALScoast[3]);
				player.giveItem(_ALScoast[4], 1);
				npc.addText("Hey! Here, take #t" + shield[3] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}

//---------------------------------------- Helmets --------------------------------
	else if(state == 100){
		npc.addText("So, what kind of a Helmet do you want to upgrade or create?");
		for(int x = 1; x < helm[0]; x++){
			npc.addText("#b\r\n#L" + (x-1) + "##t" + helm[x] + "##k " + helminfo[x] + "#l");
		}
		npc.sendSimple();
	}
	else if(state == 101){
		npc.addText("To upgrade one #t" + helm[type+1] + "#, I need following materials. Note Make sure you don't use an item that's been upgraded as a material for it. What do you think? Do you want one?");
		if(type == 0){
			for(int i = 1; i < _YellowMetalGear[0]; i++){
				if(_YellowMetalGearinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _YellowMetalGear[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _YellowMetalGear[i] + "#  #t" + _YellowMetalGear[i] + "##k");
				}
			} 
		} 
		else if(type == 1){
			for(int i = 1; i < _BluewMetalGear[0]; i++){
				if(_BluewMetalGearinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _BluewMetalGear[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _BluewMetalGear[i] + "#  #t" + _BluewMetalGear[i] + "##k");
				}
			} 
		}
		else if(type == 2){
			for(int i = 1; i < _MetalKoif[0]; i++){
				if(_MetalKoifinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MetalKoif[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MetalKoif[i] + "#  #t" + _MetalKoif[i] + "##k");
				}
			} 
		}
		else if(type == 3){
			for(int i = 1; i < _MithrilKoif[0]; i++){
				if(_MithrilKoifinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilKoif[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilKoif[i] + "#  #t" + _MithrilKoif[i] + "##k");
				}
			} 
		} 
		else if(type == 4){
			for(int i = 1; i < _SteelHelmet[0]; i++){
				if(_SteelHelmetinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _SteelHelmet[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _SteelHelmet[i] + "#  #t" + _SteelHelmet[i] + "##k");
				}
			}
		}
		else if(type == 5){
			for(int i = 1; i < _MithrilHelmet[0]; i++){
				if(_MithrilHelmetinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilHelmet[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilHelmet[i] + "#  #t" + _MithrilHelmet[i] + "##k");
				}
			}
		}
		else if(type == 6){
			for(int i = 1; i < _SteelFullHelm[0]; i++){
				if(_SteelFullHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _SteelFullHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _SteelFullHelm[i] + "#  #t" + _SteelFullHelm[i] + "##k");
				}
			}
		}
		else if(type == 7){
			for(int i = 1; i < _MithrilFullHelm[0]; i++){
				if(_MithrilFullHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilFullHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilFullHelm[i] + "#  #t" + _MithrilFullHelm[i] + "##k");
				}
			}
		}
		else if(type == 8){
			for(int i = 1; i < _IronVikingHelm[0]; i++){
				if(_IronVikingHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _IronVikingHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _IronVikingHelm[i] + "#  #t" + _IronVikingHelm[i] + "##k");
				}
			}
		}
		else if(type == 9){
			for(int i = 1; i < _MithrilVikingHelm[0]; i++){
				if(_MithrilVikingHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilVikingHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilVikingHelm[i] + "#  #t" + _MithrilVikingHelm[i] + "##k");
				}
			}
		}
		else if(type == 10){
			for(int i = 1; i < _SteelFootballHelmet[0]; i++){
				if(_SteelFootballHelmetinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _SteelFootballHelmet[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _SteelFootballHelmet[i] + "#  #t" + _SteelFootballHelmet[i] + "##k");
				}
			} 
		}
		else if(type == 11){
			for(int i = 1; i < _MithrilFootballHelmet[0]; i++){
				if(_MithrilFootballHelmetinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilFootballHelmet[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilFootballHelmet[i] + "#  #t" + _MithrilFootballHelmet[i] + "##k");
				}
			} 
		}
		else if(type == 12){
			for(int i = 1; i < _MithrilSharpHelm[0]; i++){
				if(_MithrilSharpHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilSharpHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilSharpHelm[i] + "#  #t" + _MithrilSharpHelm[i] + "##k");
				}
			} 
		}
		else if(type == 13){
			for(int i = 1; i < _GoldSharpHelm[0]; i++){
				if(_GoldSharpHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _GoldSharpHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _GoldSharpHelm[i] + "#  #t" + _GoldSharpHelm[i] + "##k");
				}
			} 
		}
		else if(type == 14){
			for(int i = 1; i < _GoldBurgernetHelm[0]; i++){
				if(_GoldBurgernetHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _GoldBurgernetHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _GoldBurgernetHelm[i] + "#  #t" + _GoldBurgernetHelm[i] + "##k");
				}
			} 
		}
		else if(type == 15){
			for(int i = 1; i < _OrihalconBurgernetHelm[0]; i++){
				if(_OrihalconBurgernetHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _OrihalconBurgernetHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _OrihalconBurgernetHelm[i] + "#  #t" + _OrihalconBurgernetHelm[i] + "##k");
				}
			} 
		}
		else if(type == 16){
			for(int i = 1; i < _GreatRedHelmet[0]; i++){
				if(_GreatRedHelmetinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _GreatRedHelmet[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _GreatRedHelmet[i] + "#  #t" + _GreatRedHelmet[i] + "##k");
				}
			} 
		}
		else if(type == 17){
			for(int i = 1; i < _GreatBlueHelmet[0]; i++){
				if(_GreatBlueHelmetinfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _GreatBlueHelmet[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _GreatBlueHelmet[i] + "#  #t" + _GreatBlueHelmet[i] + "##k");
				}
			} 
		}
		else if(type == 18){
			for(int i = 1; i < _MithrilNoordicHelm[0]; i++){
				if(_MithrilNoordicHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilNoordicHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilNoordicHelm[i] + "#  #t" + _MithrilNoordicHelm[i] + "##k");
				}
			} 
		}
		else if(type == 19){
			for(int i = 1; i < _GoldNoordicHelm[0]; i++){
				if(_GoldNoordicHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _GoldNoordicHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _GoldNoordicHelm[i] + "#  #t" + _GoldNoordicHelm[i] + "##k");
				}
			} 
		}
		else if(type == 20){
			for(int i = 1; i < _MithrilCrusaderHelm[0]; i++){
				if(_MithrilCrusaderHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _MithrilCrusaderHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _MithrilCrusaderHelm[i] + "#  #t" + _MithrilCrusaderHelm[i] + "##k");
				}
			} 
		}
		else if(type == 21){
			for(int i = 1; i < _SilverCrusaderHelm[0]; i++){
				if(_SilverCrusaderHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _SilverCrusaderHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _SilverCrusaderHelm[i] + "#  #t" + _SilverCrusaderHelm[i] + "##k");
				}
			} 
		}
		else if(type == 22){
			for(int i = 1; i < _OldSteelNordicHelm[0]; i++){
				if(_OldSteelNordicHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _OldSteelNordicHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _OldSteelNordicHelm[i] + "#  #t" + _OldSteelNordicHelm[i] + "##k");
				}
			} 
		}
		else if(type == 23){
			for(int i = 1; i < _OldMithrilNordicHelm[0]; i++){
				if(_OldMithrilNordicHelminfo[i] == 0){
					npc.addText("#b\r\n#v4031138# " + _OldMithrilNordicHelm[i] + "mesos #k");
				}
				else {
					npc.addText("#b\r\n#v" + _OldMithrilNordicHelm[i] + "#  #t" + _OldMithrilNordicHelm[i] + "##k");
				}
			} 
		} 

		npc.setState(npc.getState()+type);
		npc.sendYesNo();
	}
	else if(state == 102){ // Yellow Metal Gear
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_YMGcoast[0]) > 0) && (player.getItemAmount(_YMGcoast[1]) >= 1) && (player.getMesos() >= _YMGcoast[2])) {
				player.giveItem(_YMGcoast[0], -1);
				player.giveItem(_YMGcoast[1], -1);
				player.giveMesos(-_YMGcoast[2]);
				player.giveItem(_YMGcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 103){ // Blue Metal Gear
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_BMGcoast[0]) > 0) && (player.getItemAmount(_BMGcoast[1]) >= 1) && (player.getMesos() >= _BMGcoast[2])) {
				player.giveItem(_BMGcoast[0], -1);
				player.giveItem(_BMGcoast[1], -1);
				player.giveMesos(-_BMGcoast[2]);
				player.giveItem(_BMGcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 104){ // Metal Koif
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MKcoast[0]) > 0) && (player.getItemAmount(_MKcoast[1]) >= 1) && (player.getMesos() >= _MKcoast[2])) {
				player.giveItem(_MKcoast[0], -1);
				player.giveItem(_MKcoast[1], -1);
				player.giveMesos(-_MKcoast[2]);
				player.giveItem(_MKcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 105){ // Mithril Koif
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MiKcoast[0]) > 0) && (player.getItemAmount(_MiKcoast[1]) >= 1) && (player.getMesos() >= _MiKcoast[2])) {
				player.giveItem(_MiKcoast[0], -1);
				player.giveItem(_MiKcoast[1], -1);
				player.giveMesos(-_MiKcoast[2]);
				player.giveItem(_MiKcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 106){ // Steel Helmet
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_SHcoast[0]) > 0) && (player.getItemAmount(_SHcoast[1]) >= 1) && (player.getMesos() >= _SHcoast[2])) {
				player.giveItem(_SHcoast[0], -1);
				player.giveItem(_SHcoast[1], -1);
				player.giveMesos(-_SHcoast[2]);
				player.giveItem(_SHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 107){ // Mithri Helmet
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MHcoast[0]) > 0) && (player.getItemAmount(_MHcoast[1]) >= 1) && (player.getMesos() >= _MHcoast[2])) {
				player.giveItem(_MHcoast[0], -1);
				player.giveItem(_MHcoast[1], -1);
				player.giveMesos(-_MHcoast[2]);
				player.giveItem(_MHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 108){ // Steel Full Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_StFHcoast[0]) > 0) && (player.getItemAmount(_StFHcoast[1]) >= 2) && (player.getMesos() >= _StFHcoast[2])) {
				player.giveItem(_StFHcoast[0], -1);
				player.giveItem(_StFHcoast[1], -2);
				player.giveMesos(-_StFHcoast[2]);
				player.giveItem(_StFHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 109){ // Mithril Full Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MiFHcoast[0]) > 0) && (player.getItemAmount(_MiFHcoast[1]) >= 2) && (player.getMesos() >= _MiFHcoast[2])) {
				player.giveItem(_MiFHcoast[0], -1);
				player.giveItem(_MiFHcoast[1], -2);
				player.giveMesos(-_MiFHcoast[2]);
				player.giveItem(_MiFHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 110){ // Iron Viking Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_IVHcoast[0]) > 0) && (player.getItemAmount(_IVHcoast[1]) >= 3) && (player.getMesos() >= _IVHcoast[2])) {
				player.giveItem(_IVHcoast[0], -1);
				player.giveItem(_IVHcoast[1], -3);
				player.giveMesos(-_IVHcoast[2]);
				player.giveItem(_IVHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 111){ // Mithril Viking Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MVHcoast[0]) > 0) && (player.getItemAmount(_MVHcoast[1]) >= 3) && (player.getMesos() >= _MVHcoast[2])) {
				player.giveItem(_MVHcoast[0], -1);
				player.giveItem(_MVHcoast[1], -3);
				player.giveMesos(-_MVHcoast[2]);
				player.giveItem(_MVHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 112){ // Steel Football Helmet
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_SFHcoast[0]) > 0) && (player.getItemAmount(_SFHcoast[1]) >= 3) && (player.getMesos() >= _SFHcoast[2])) {
				player.giveItem(_SFHcoast[0], -1);
				player.giveItem(_SFHcoast[1], -3);
				player.giveMesos(-_SFHcoast[2]);
				player.giveItem(_SFHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 113){ // Mithril Football Helmet
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MFHcoast[0]) > 0) && (player.getItemAmount(_MFHcoast[1]) >= 3) && (player.getMesos() >= _MFHcoast[2])) {
				player.giveItem(_MFHcoast[0], -1);
				player.giveItem(_MFHcoast[1], -3);
				player.giveMesos(-_MFHcoast[2]);
				player.giveItem(_MFHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 114){ // Mithril Sharp Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MSHcoast[0]) > 0) && (player.getItemAmount(_MSHcoast[1]) >= 4) && (player.getMesos() >= _MSHcoast[2])) {
				player.giveItem(_MSHcoast[0], -1);
				player.giveItem(_MSHcoast[1], -4);
				player.giveMesos(-_MSHcoast[2]);
				player.giveItem(_MSHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 115){ // Gold Sharp Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_GSHcoast[0]) > 0) && (player.getItemAmount(_GSHcoast[1]) >= 4) && (player.getMesos() >= _GSHcoast[2])) {
				player.giveItem(_GSHcoast[0], -1);
				player.giveItem(_GSHcoast[1], -4);
				player.giveMesos(-_GSHcoast[2]);
				player.giveItem(_GSHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 116){ // Gold Burgernet Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_GoBHcoast[0]) > 0) && (player.getItemAmount(_GoBHcoast[1]) >= 5) && (player.getMesos() >= _GoBHcoast[2])) {
				player.giveItem(_GoBHcoast[0], -1);
				player.giveItem(_GoBHcoast[1], -5);
				player.giveMesos(-_GoBHcoast[2]);
				player.giveItem(_GoBHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 117){ // Orihalcon Burgernet Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_OBHcoast[0]) > 0) && (player.getItemAmount(_OBHcoast[1]) >= 5) && (player.getMesos() >= _OBHcoast[2])) {
				player.giveItem(_OBHcoast[0], -1);
				player.giveItem(_OBHcoast[1], -5);
				player.giveMesos(-_OBHcoast[2]);
				player.giveItem(_OBHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 118){ // Great Red Helmet
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_GRHcoast[0]) > 0) && (player.getItemAmount(_GRHcoast[1]) >= 3) && (player.getMesos() >= _GRHcoast[2])) {
				player.giveItem(_GRHcoast[0], -1);
				player.giveItem(_GRHcoast[1], -3);
				player.giveMesos(-_GRHcoast[2]);
				player.giveItem(_GRHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 119){ // Great Blue Helmet
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_GBHcoast[0]) > 0) && (player.getItemAmount(_GBHcoast[1]) >= 3) && (player.getMesos() >= _GBHcoast[2])) {
				player.giveItem(_GBHcoast[0], -1);
				player.giveItem(_GBHcoast[1], -3);
				player.giveMesos(-_GBHcoast[2]);
				player.giveItem(_GBHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 120){ // Mithril Noordic Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MNHcoast[0]) > 0) && (player.getItemAmount(_MNHcoast[1]) >= 5) && (player.getMesos() >= _MNHcoast[2])) {
				player.giveItem(_MNHcoast[0], -1);
				player.giveItem(_MNHcoast[1], -5);
				player.giveMesos(-_MNHcoast[2]);
				player.giveItem(_MNHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 121){ // Gold Noordic Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_GNHcoast[0]) > 0) && (player.getItemAmount(_GNHcoast[1]) >= 6) && (player.getMesos() >= _GNHcoast[2])) {
				player.giveItem(_GNHcoast[0], -1);
				player.giveItem(_GNHcoast[1], -6);
				player.giveMesos(-_GNHcoast[2]);
				player.giveItem(_GNHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 122){ // Mithril Crusader Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_MCHcoast[0]) > 0) && (player.getItemAmount(_MCHcoast[1]) >= 5) && (player.getMesos() >= _MCHcoast[2])) {
				player.giveItem(_MCHcoast[0], -1);
				player.giveItem(_MCHcoast[1], -5);
				player.giveMesos(-_MCHcoast[2]);
				player.giveItem(_MCHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 123){ // Silver Crusader Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_SCHcoast[0]) > 0) && (player.getItemAmount(_SCHcoast[1]) >= 4) && (player.getMesos() >= _SCHcoast[2])) {
				player.giveItem(_SCHcoast[0], -1);
				player.giveItem(_SCHcoast[1], -4);
				player.giveMesos(-_SCHcoast[2]);
				player.giveItem(_SCHcoast[3], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}

		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 124){ // Old Steel Nordic Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_OSNHcoast[0]) > 0) && (player.getItemAmount(_OSNHcoast[1]) > 0) && (player.getItemAmount(_OSNHcoast[2]) >= 7) && (player.getMesos() >= _OSNHcoast[3])) {
				player.giveItem(_OSNHcoast[0], -1);
				player.giveItem(_OSNHcoast[1], -1);
				player.giveItem(_OSNHcoast[2], -7);
				player.giveMesos(-_OSNHcoast[3]);
				player.giveItem(_OSNHcoast[4], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}

		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	}
	else if(state == 125){ // Old Mithril Nordic Helm
		if(npc.getSelected() == YES){
			if((player.getItemAmount(_OMNHcoast[0]) > 0) && (player.getItemAmount(_OMNHcoast[1]) > 0) && (player.getItemAmount(_OMNHcoast[2]) >= 7) && (player.getMesos() >= _OMNHcoast[3])) {
				player.giveItem(_OMNHcoast[0], -1);
				player.giveItem(_OMNHcoast[1], -1);
				player.giveItem(_OMNHcoast[2], -7);
				player.giveMesos(-_OMNHcoast[3]);
				player.giveItem(_OMNHcoast[4], 1);
				npc.addText("Hey! Here, take #t" + helm[npc.getState()-102] + "#. This came out even finer than I thought... I don't think you'll see this fine refined item like this anywhere else! Please come again soon!");
				npc.sendOK();
				npc.end();
			}
			else{
				npc.addText("Please double check you have all the materials you need and if your ETC inventory is full or not.");
				npc.sendNext();
				npc.end();
			}
		}
		else if(npc.getSelected() == NO){
			npc.addText("Really? Sorry to hear that. Come back here when you need me.");
			npc.sendNext();
			npc.end();
		}
	} 
}